package com.xingkeduo.business.operation.controller.cms;

import com.xingkeduo.business.operation.domain.HairstyleDomain;
import com.xingkeduo.pojo.dto.Hairstyle.HairstyleDTO;
import com.xingkeduo.pojo.json.HairstyleJson;
import com.xingkeduo.pojo.query.HairstyleQuery;
import com.xingkeduo.pojo.table.HairstyleTable;
import com.xingkeduo.tool.ResponseUtils;
import com.xingkeduo.util.pojo.base.BaseController;
import com.xingkeduo.util.pojo.domain.Page;
import com.xingkeduo.util.pojo.exception.SystemException;
import com.xingkeduo.util.tool.ReturnUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import static com.xingkeduo.tool.OperaConstants.CMS_URL_PREFIX;

/**
 * 文件概述
 *
 * @author chenxiangda <chenxiangda@xingkeduo.com>
 * @version id:v0.1 19-1-25 上午10:42
 * @package BeautyOS
 * @copyright Copyright (c) XKD 2019
 */
@RestController
@RequestMapping(CMS_URL_PREFIX + "/chairstyle")
public class CHairstyleController extends BaseController {

    @Autowired
    private HairstyleDomain hairstyleDomain;
    //查询列表
    @RequestMapping(value = "/lists", method = RequestMethod.GET)
    @ResponseBody
    public ResponseUtils doGetLists(HairstyleQuery hairstyleQuery) {
        returnUtil = new ReturnUtil();
        try {
            Page<HairstyleTable> hairstylePageList = hairstyleDomain.getHairstylePageList(hairstyleQuery);
            return ResponseUtils.getSuccess(hairstylePageList);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
            return ResponseUtils.error(throwable.getMessage(), SystemException.Type.DEFAULT.toString());
        }
    }
}
